package com.topscomm.file.upload;

import java.util.concurrent.Callable;

import com.topscomm.core.factory.FileStoreFactoryService;
import com.topscomm.file.FileInfoDTO;
import com.topscomm.pub.util.SpringUtil;

/**
 * 线程上传任务
 * 
 * @description:
 * @author: donghang
 * @date: 2021年3月19日上午12:03:10
 * @modify:
 */
public class FileUploadTask implements Callable<Boolean> {
	private FileInfoDTO fileInfo;

	public FileUploadTask(FileInfoDTO fileInfo) {
		this.fileInfo = fileInfo;
	}

	/**
	 * 上传
	 * 
	 * @description:
	 * @return
	 * @throws Exception
	 * @author: donghang
	 * @date: 2021年3月19日上午12:11:44
	 * @modify:
	 */
	@Override
	public Boolean call() throws Exception {
		FileStoreFactoryService fileStoreFactoryService = (FileStoreFactoryService) SpringUtil
				.getBean("fileStoreFactoryService");
		// 上传文件
		fileStoreFactoryService.upload(fileInfo);
		return true;
	}

}
